import time


class TicTocDecorator:
    def __init__(self, times=1):
        self.times = times

    def __call__(self, func):
        def warpper(*args, **kwargs):
            start = time.time()
            for idx in range(self.times):
                res = func(*args, **kwargs)
            end = time.time()
            print('---{}--- cost <{}>ms , repeate<{}> times'.format(func.__name__, end - start, self.times))
            return res
        return warpper



if __name__ =='__main__':
    @TicTocDecorator(50)
    def add(a, b):
        c = a
        for i in range(10000):
            c+=b*a+b*i
        return c

    c= add(100000,1)

    pass

